package main

func largestAltitude(gain []int) int {
	total := 0
	var res int
	for _, x := range gain {
		total += x
		res = max(res,total)
	}
	return res
}

func max(a,b int) int{
	if a>b{return a}
	return b
}
